<body>
        <div id="longDesc">
            <h1 style="color:#2e74b5; font-family:Calibri Light; font-size:large">Introduction</h1>       
            <div id="longDesc">
                <span style="font-family:Calibri; font-size:medium">
                    <p>
                        The<strong> xActiveDirectory</strong> module is a part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit, which is a collection of DSC Resources produced by the PowerShell Team. This module contains the
                        <strong>xADDomain, xADDomainController, xADUser, xWaitForDomain, and xADDomainTrust</strong> resources. These DSC Resources allow you to configure and manage Active Directory.&nbsp; Note: these resources do not presently install the RSAT tools.
                    </p>
                    <p>
                        <strong>All of the resources in the DSC Resource Kit are provided AS IS, and are not supported through any Microsoft standard support program or service. The &quot;x&quot; in xActiveDirectory stands for experimental</strong>, which means that these resources will
                        be <strong>fix forward</strong> and monitored by the module owner(s).
                    </p>
                    <p>Please leave comments, feature requests, and bug reports in the Q &amp; A tab for this module.</p>
                    <p>
                        If you would like to modify <strong>xActiveDirectory</strong> module, feel free. When modifying, please update the module name, resource friendly name, and MOF class name (instructions below). As specified in the license, you may copy or modify this resource
                        as long as they are used on the Windows Platform.
                    </p>
                    <p>
                        For more information about Windows PowerShell Desired State Configuration, check out the blog posts on the
                        <a href="http://blogs.msdn.com/b/powershell/"><span style="color:#0000ff">PowerShell Blog</span></a> (<a href="http://blogs.msdn.com/b/powershell/archive/2013/11/01/configuration-in-a-devops-world-windows-powershell-desired-state-configuration.aspx"><span style="color:#0000ff">this</span></a>
                        is a good starting point). There are also great community resources, such as <a href="http://powershell.org/wp/tag/dsc/">
                            <span style="color:#0000ff">PowerShell.org</span>
                        </a>, or <a href="http://www.powershellmagazine.com/tag/dsc/">
                            <span style="color:#0000ff">PowerShell Magazine</span>
                        </a>. For more information on the DSC Resource Kit, check out
                        <a href="http://go.microsoft.com/fwlink/?LinkID=389546"><span style="color:#0000ff">this blog post</span></a>.
                    </p>
                    <h1 style="color:#2e74b5; font-family:Calibri Light; font-size:large">Installation</h1>
                    <p>To install <strong>xActiveDirectory</strong> module</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>Unzip the content under $env:ProgramFiles\WindowsPowerShell\Modules folder </li>
                    </ul>
                    <p>To confirm installation:</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            Run <strong>Get-DSCResource</strong> to see that <strong>xADDomain, xADDomainController, xADUser, xWaitForDomain, and xADDomainTrust</strong> are among the DSC Resources listed
                        </li>
                    </ul>
                    <h1 style="color:#2e74b5; font-family:Calibri Light; font-size:large">Requirements</h1>
                    <p>
                        This module requires the latest version of PowerShell (v4.0, which ships in Windows 8.1 or Windows Server 2012R2). To easily use PowerShell 4.0 on older operating systems,
                        <a href="http://www.microsoft.com/en-us/download/details.aspx?id=40855"><span style="color:#0000ff">install WMF 4.0</span></a>. Please read the installation instructions that are present on both the download page and the release notes for WMF 4.0.
                    </p>
                    <h1 style="color:#2e74b5; font-family:Calibri Light; font-size:large">Description</h1>
                    <p>
                        The <strong>xActiveDirectory </strong>module contains the <strong>xADDomain, xADDomainController, xADUser, xWaitForDomain, and ADDomainTrust</strong> DSC Resources. These DSC Resources allow you to configure new domain, child domains,high availability domain
                        controllers&nbsp;and establish cross-domain trusts.&nbsp; <span style="font-family:Calibri; font-size:medium">
                            The <span style="font-family:Calibri; font-size:medium">
                                <strong>xADDomain</strong>
                            </span>resource is responsible to create new Active directory forest configuration or new Active directory domain configuration.&nbsp;<span style="font-family:Calibri; font-size:medium">
                                The
                                <span style="font-family:Calibri; font-size:medium">
                                    <strong>xADDomainController </strong>
                                </span>resource is responsible to install a domain controller in Active directory.&nbsp;
                                <span style="font-family:Calibri; font-size:medium">
                                    The <span style="font-family:Calibri; font-size:medium">
                                        <strong>xADUser</strong>
                                    </span>resource is responsible to modify or remove Active directory User.&nbsp;<span style="font-family:Calibri; font-size:medium">
                                        The
                                        <span style="font-family:Calibri; font-size:medium"><strong>xWaitForDomain</strong></span> resource is responsible to wait for new domain to setup. It's worth noting that the RSAT tools will not be installed when these resources are used to configure AD. The
                                        <span style="font-family:Calibri; font-size:medium"><strong>xADDomainTrust</strong></span> resource is used to establish a cross-domain trust.&nbsp;<span style="font-family:Calibri; font-size:medium">
                                            <br>
                                        </span>
                                    </span>
                                </span>
                            </span>
                        </span>
                    </p>
                    <h1 style="color:#2e74b5; font-family:Calibri Light; font-size:large">Details</h1>
                    <p><strong>xADDomain</strong> resource has following properties:</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            <strong>DomainName</strong>: <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                            </span>Name of the domain.&nbsp; If no parent name is specified, this is the fully qualified domain name for first domain in the forest.
                        </li>
                        <li>
                            <strong>ParentDomainName</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Name of the parent domain.
                        </li>
                        <li>
                            <strong>DomainAdministratorCredential</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Credentials used to query for domain existence. Note: These are not used during domain creation. ( AD sets the localadmin credentials as new domain administrator credentials
                            during setup )<span style="font-family:Calibri; font-size:medium">
                                <br>
                            </span>
                        </li>
                        <li>
                            <strong>SafemodeAdministratorPassword</strong>: <span>&nbsp;&nbsp;&nbsp; </span>
                            <span style="font-family:Calibri; font-size:medium">
                                Password for the administrator account when the computer is started in Safe Mode.
                            </span>
                        </li>
                        <li>
                            <strong>
                                DnsDelegationCredential: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                            </strong><span style="font-family:Calibri; font-size:medium">Credential used for creating DNS delegation</span>
                        </li>
                    </ul>
                    <p><strong>xADDomainController</strong> resource has following properties:</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            <strong>DomainName</strong>: <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </span>The fully qualified domain name for the domain where the domain controller will be present
                        </li>
                        <li>
                            <strong>DomainAdministratorCredential</strong>: <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </span>Specifies the credential for the account used to install the domain controller
                        </li>
                        <li>
                            <strong>SafemodeAdministratorPassword</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Password for the administrator account when the computer is started in Safe Mode.
                        </li>
                    </ul>
                    <p><strong>xADUser</strong> resource has following properties:</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            <strong>Ensure</strong>: <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </span>Specifies whether the given user is present or absent
                        </li>
                        <li>
                            <strong>DomainName</strong>: <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </span>Name of the domain to which the user will be added
                        </li>
                        <li>
                            <strong>UserName</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            Name of the user
                        </li>
                        <li>
                            <strong>Password</strong>: <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                Password value for the account
                            </span>
                        </li>
                        <li>
                            <strong>DomainAdministratorCredential: &nbsp; &nbsp; &nbsp; &nbsp; </strong>User account credentials used to perform the task
                        </li>
                    </ul>
                    <p><strong>xWaitForADDomain</strong> resource has following properties:</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            <strong>DomainName</strong>: <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </span>Name of the domain to wait for
                        </li>
                        <li>
                            <strong>RetryIntervalSec</strong>: <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </span>Interval to check for the domain's existance
                        </li>
                        <li>
                            <strong>RetryCount</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            Maximum number of retries to check for the domain's existance
                        </li>
                    </ul>
                    <p><strong>xADDomainTrust</strong> resource has following properties:</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            <strong>Ensure:</strong> <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </span>Specifies whether the domain trust is present or absent
                        </li>
                        <li>
                            <strong>TargetDomainAdministratorCredential: </strong><span style="font-family:Calibri; font-size:medium">Credentials to authenticate to the target domain</span>
                        </li>
                        <li>
                            <strong>TargetDomainName:</strong> <span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                            </span>Name of the AD domain that is being trusted
                        </li>
                        <li>
                            <strong>TrustType:</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Type of trust
                        </li>
                        <li>
                            <strong>TrustDirection:</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                            &nbsp; &nbsp; Direction of trust, the values for which may be Bidirectional,Inbound, or Outbound
                        </li>
                        <li>
                            <strong>SourceDomainName:</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Name of the AD domain that is requesting the trust
                        </li>
                    </ul>
                    <h1 style="color:#2e74b5; font-family:Calibri Light; font-size:large">Renaming Requirements</h1>
                    <p>When making changes to these resources, we suggest the following practice:</p>
                    <ol style="list-style-type:decimal; direction:ltr">
                        <li>
                            Update the following names by replacing MSFT with your company/community name and replacing the
                            <strong>&quot;x&quot;</strong> with <strong>&quot;c&quot;</strong> (short for &quot;Community&quot;) or another prefix of your choice:
                            <ul>
                                <li>
                                    <strong>Module name (ex: x<span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span></strong> becomes
                                    <strong>c<span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span></strong>)
                                </li>
                                <li>
                                    <strong>Resource folder (ex: MSFT_</strong><span style="font-family:Calibri; font-size:medium"><strong>xADDomain</strong></span> becomes
                                    <strong>Contoso_x</strong><span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span>)
                                </li>
                                <li>
                                    <strong>Resource Name (ex: MSFT_<span style="font-family:Calibri; font-size:medium"><strong>xADDomain</strong></span></strong> becomes
                                    <strong>Contoso_c</strong><span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span>)
                                </li>
                                <li>
                                    <strong>
                                        Resource Friendly Name (ex: <span style="font-family:Calibri; font-size:medium">
                                            <strong>xADDomain</strong>
                                        </span>
                                    </strong>becomes <strong>c<span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span></strong>)
                                </li>
                                <li>
                                    <strong>MOF class name (ex: MSFT_x<span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span></strong> becomes
                                    <strong>Contoso_c<span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span></strong>)
                                </li>
                                <li>
                                    <strong>Filename for the &lt;resource&gt;.schema.mof (ex: MSFT_x<span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span></strong>.schema.mof becomes
                                    <strong>Contoso_c<span style="font-family:Calibri; font-size:medium"><strong>ADDomain</strong></span></strong>.schema.mof)
                                </li>
                            </ul>
                        </li>
                        <li>Update module and metadata information in the module manifest </li>
                        <li>Update any configuration that use these resources </li>
                    </ol>
                    <p>
                        <em>
                            We reserve resource and module names without prefixes (&quot;x&quot; or &quot;c&quot;) for future use (e.g. &quot;MSFT_ADDomain&quot; or &quot;MSFT_ADUser&quot;). If the next version of Windows Server ships with a &quot;ADDomain&quot; resource, we don't want to break any configurations that use any
                            community modifications. Please keep a prefix such as &quot;c&quot; on all community modifications.
                        </em>
                    </p>
                    <h1 style="color:#2e74b5; font-family:Calibri Light; font-size:large">Versions</h1>
                    <p>1.0.0.0</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            Initial release with the following resources
                            <ul style="list-style-type:circle">
                                <li>
                                    <span style="font-family:Calibri; font-size:medium">xADDomain, xADDomainController, xADUser, and xWaitForDomain</span>
                                </li>
                            </ul>
                        </li>
                    </ul>
                    <p>2.0.0.0</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            Updated release, which added the resource
                            <ul style="list-style-type:circle">
                                <li><span style="font-family:Calibri; font-size:medium">xADDomainTrust</span> </li>
                            </ul>
                        </li>
                    </ul>
                    <p>2.1.0.0</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            Minor update: Get-TargetResource to use domain name instead of name
                        </li>
                    </ul>
                    <p>2.2</p>
                    <ul style="list-style-type:disc; direction:ltr">
                        <li>
                            Modified xAdDomain and xAdDomainController to support Ensure as Present / Absent, rather than True/False. Note: this may cause issues for existing scripts. Also corrected return value to be a hashtable in both resources. 
                        </li>
                    </ul>
                    <h1 style="margin-bottom:0pt; font-family:Calibri Light; color:#2e74b5; font-size:large">
                        Example: Create a highly available Domain using multiple domain controllers
                    </h1>
                    <p>
                        In the following example configuration, a highly available domain is created by adding a domain controller to an existing domain.&nbsp; This example uses the xWaitForDomain resource to ensure that the domain is present before the second domain controller
                        is added.
                    </p>
                    <div class="scriptcode">
                        <div class="pluginEditHolder" plugincommand="mceScriptCode">
                            <div class="title"><span>PowerShell</span></div>
                            <div class="pluginLinkHolder"><span class="pluginEditHolderLink">Edit</span>|<span class="pluginRemoveHolderLink">Remove</span></div>
                            <span class="hidden">powershell</span>
<pre class="hidden"># A configuration to Create High Availability Domain Controller 
configuration AssertHADC
{
   param
    (
        [Parameter(Mandatory)]
        [pscredential]$safemodeAdministratorCred,
        [Parameter(Mandatory)]
        [pscredential]$domainCred,
	    [Parameter(Mandatory)]
        [pscredential]$DNSDelegationCred,
	    [Parameter(Mandatory)]
        [pscredential]$NewADUserCred
    )
    Import-DscResource -ModuleName xActiveDirectory
    Node $AllNodes.Where{$_.Role -eq &quot;Primary DC&quot;}.Nodename
    {
        WindowsFeature ADDSInstall
        {
            Ensure = &quot;Present&quot;
            Name = &quot;AD-Domain-Services&quot;
        }
        xADDomain FirstDS
        {
            DomainName = $Node.DomainName
            DomainAdministratorCredential = $domainCred
            SafemodeAdministratorPassword = $safemodeAdministratorCred
            DnsDelegationCredential = $DNSDelegationCred
            DependsOn = &quot;[WindowsFeature]ADDSInstall&quot;
        }
        xWaitForADDomain DscForestWait
        {
            DomainName = $Node.DomainName
            DomainUserCredential = $domainCred
            RetryCount = $Node.RetryCount
            RetryIntervalSec = $Node.RetryIntervalSec
            DependsOn = &quot;[xADDomain]FirstDS&quot;
        }
        xADUser FirstUser
        {
            DomainName = $Node.DomainName
            DomainAdministratorCredential = $domainCred
            UserName = &quot;dummy&quot;
            Password = $NewADUserCred
            Ensure = &quot;Present&quot;
            DependsOn = &quot;[xWaitForADDomain]DscForestWait&quot;
        }
    }
    Node $AllNodes.Where{$_.Role -eq &quot;Replica DC&quot;}.Nodename
    {
        WindowsFeature ADDSInstall
        {
            Ensure = &quot;Present&quot;
            Name = &quot;AD-Domain-Services&quot;
        }
        xWaitForADDomain DscForestWait
        {
            DomainName = $Node.DomainName
            DomainUserCredential = $domainCred
	        RetryCount = $Node.RetryCount
            RetryIntervalSec = $Node.RetryIntervalSec
            DependsOn = &quot;[WindowsFeature]ADDSInstall&quot;
        }
        xADDomainController SecondDC
        {
            DomainName = $Node.DomainName
            DomainAdministratorCredential = $domainCred
            SafemodeAdministratorPassword = $safemodeAdministratorCred
            DnsDelegationCredential = $DNSDelegationCred
            DependsOn = &quot;[xWaitForADDomain]DscForestWait&quot;
        }
    }
}
# Configuration Data for AD 
$ConfigData = @{
    AllNodes = @(
        @{
            Nodename = &quot;dsc-testNode1&quot;
            Role = &quot;Primary DC&quot;
            DomainName = &quot;dsc-test.contoso.com&quot;
            CertificateFile = &quot;C:\publicKeys\targetNode.cer&quot;  
            Thumbprint = &quot;AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8&quot; 
	        RetryCount = 20 
	        RetryIntervalSec = 30 
        },
        @{
            Nodename = &quot;dsc-testNode2&quot;
            Role = &quot;Replica DC&quot;
            DomainName = &quot;dsc-test.contoso.com&quot;
            CertificateFile = &quot;C:\publicKeys\targetNode.cer&quot;  
            Thumbprint = &quot;AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8&quot; 
	        RetryCount = 20 
	        RetryIntervalSec = 30 
        }
    )
}
AssertHADC -configurationData $ConfigData `
-safemodeAdministratorCred (Get-Credential -Message &quot;New Domain Safe Mode Admin Credentials&quot;) `
-domainCred (Get-Credential -Message &quot;New Domain Admin Credentials&quot;) `
-DNSDelegationCred (Get-Credential -Message &quot;Credentials to Setup DNS Delegation&quot;) `
-NewADUserCred (Get-Credential -Message &quot;New AD User Credentials&quot;)
Start-DscConfiguration -Wait -Force -Verbose -ComputerName &quot;dsc-testNode1&quot; -Path $PSScriptRoot\AssertHADC `
-Credential (Get-Credential -Message &quot;Local Admin Credentials on Remote Machine&quot;)
Start-DscConfiguration -Wait -Force -Verbose -ComputerName &quot;dsc-testNode2&quot; -Path $PSScriptRoot\AssertHADC `
-Credential (Get-Credential -Message &quot;Local Admin Credentials on Remote Machine&quot;)
</pre>
                            <div class="preview">
<pre class="powershell"><span class="powerShell__com">#&nbsp;A&nbsp;configuration&nbsp;to&nbsp;Create&nbsp;High&nbsp;Availability&nbsp;Domain&nbsp;Controller&nbsp;</span>&nbsp;
&nbsp;
configuration&nbsp;AssertHADC&nbsp;
{&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;<span class="powerShell__keyword">param</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$safemodeAdministratorCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$domainCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$DNSDelegationCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$NewADUserCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Import<span class="powerShell__operator">-</span>DscResource&nbsp;<span class="powerShell__operator">-</span>ModuleName&nbsp;xActiveDirectory&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Node&nbsp;<span class="powerShell__variable">$AllNodes</span>.Where{<span class="powerShell__variable">$_</span>.Role&nbsp;<span class="powerShell__operator">-</span>eq&nbsp;<span class="powerShell__string">&quot;Primary&nbsp;DC&quot;</span>}.Nodename&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WindowsFeature&nbsp;ADDSInstall&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;=&nbsp;<span class="powerShell__string">&quot;AD-Domain-Services&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADDomain&nbsp;FirstDS&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SafemodeAdministratorPassword&nbsp;=&nbsp;<span class="powerShell__variable">$safemodeAdministratorCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DnsDelegationCredential&nbsp;=&nbsp;<span class="powerShell__variable">$DNSDelegationCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[WindowsFeature]ADDSInstall&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xWaitForADDomain&nbsp;DscForestWait&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainUserCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryCount&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryIntervalSec&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xADDomain]FirstDS&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADUser&nbsp;FirstUser&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UserName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dummy&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Password&nbsp;=&nbsp;<span class="powerShell__variable">$NewADUserCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xWaitForADDomain]DscForestWait&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Node&nbsp;<span class="powerShell__variable">$AllNodes</span>.Where{<span class="powerShell__variable">$_</span>.Role&nbsp;<span class="powerShell__operator">-</span>eq&nbsp;<span class="powerShell__string">&quot;Replica&nbsp;DC&quot;</span>}.Nodename&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WindowsFeature&nbsp;ADDSInstall&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;=&nbsp;<span class="powerShell__string">&quot;AD-Domain-Services&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xWaitForADDomain&nbsp;DscForestWait&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainUserCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryCount&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryIntervalSec&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[WindowsFeature]ADDSInstall&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADDomainController&nbsp;SecondDC&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SafemodeAdministratorPassword&nbsp;=&nbsp;<span class="powerShell__variable">$safemodeAdministratorCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DnsDelegationCredential&nbsp;=&nbsp;<span class="powerShell__variable">$DNSDelegationCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xWaitForADDomain]DscForestWait&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
}&nbsp;
&nbsp;
<span class="powerShell__com">#&nbsp;Configuration&nbsp;Data&nbsp;for&nbsp;AD&nbsp;</span>&nbsp;
&nbsp;
<span class="powerShell__variable">$ConfigData</span>&nbsp;=&nbsp;@{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;AllNodes&nbsp;=&nbsp;@(&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nodename&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-testNode1&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Role&nbsp;=&nbsp;<span class="powerShell__string">&quot;Primary&nbsp;DC&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-test.contoso.com&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CertificateFile&nbsp;=&nbsp;<span class="powerShell__string">&quot;C:\publicKeys\targetNode.cer&quot;</span>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thumbprint&nbsp;=&nbsp;<span class="powerShell__string">&quot;AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8&quot;</span>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;20&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;30&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nodename&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-testNode2&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Role&nbsp;=&nbsp;<span class="powerShell__string">&quot;Replica&nbsp;DC&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-test.contoso.com&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CertificateFile&nbsp;=&nbsp;<span class="powerShell__string">&quot;C:\publicKeys\targetNode.cer&quot;</span>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thumbprint&nbsp;=&nbsp;<span class="powerShell__string">&quot;AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8&quot;</span>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;20&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;30&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;
}&nbsp;
&nbsp;
AssertHADC&nbsp;<span class="powerShell__operator">-</span>configurationData&nbsp;<span class="powerShell__variable">$ConfigData</span>&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>safemodeAdministratorCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;Domain&nbsp;Safe&nbsp;Mode&nbsp;Admin&nbsp;Credentials&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>domainCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;Domain&nbsp;Admin&nbsp;Credentials&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>DNSDelegationCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Credentials&nbsp;to&nbsp;Setup&nbsp;DNS&nbsp;Delegation&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>NewADUserCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;AD&nbsp;User&nbsp;Credentials&quot;</span>)&nbsp;
&nbsp;
Start<span class="powerShell__operator">-</span>DscConfiguration&nbsp;<span class="powerShell__operator">-</span>Wait&nbsp;<span class="powerShell__operator">-</span>Force&nbsp;<span class="powerShell__operator">-</span>Verbose&nbsp;<span class="powerShell__operator">-</span>ComputerName&nbsp;<span class="powerShell__string">&quot;dsc-testNode1&quot;</span>&nbsp;<span class="powerShell__operator">-</span>Path&nbsp;<span class="powerShell__variable">$PSScriptRoot</span>\AssertHADC&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>Credential&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Local&nbsp;Admin&nbsp;Credentials&nbsp;on&nbsp;Remote&nbsp;Machine&quot;</span>)&nbsp;
&nbsp;
Start<span class="powerShell__operator">-</span>DscConfiguration&nbsp;<span class="powerShell__operator">-</span>Wait&nbsp;<span class="powerShell__operator">-</span>Force&nbsp;<span class="powerShell__operator">-</span>Verbose&nbsp;<span class="powerShell__operator">-</span>ComputerName&nbsp;<span class="powerShell__string">&quot;dsc-testNode2&quot;</span>&nbsp;<span class="powerShell__operator">-</span>Path&nbsp;<span class="powerShell__variable">$PSScriptRoot</span>\AssertHADC&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>Credential&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Local&nbsp;Admin&nbsp;Credentials&nbsp;on&nbsp;Remote&nbsp;Machine&quot;</span>)&nbsp;
</pre>
                            </div>
                        </div>
                    </div>
                    <div class="endscriptcode">
                        &nbsp;<span style="font-family:Calibri; font-size:medium">
                            <h1 style="margin-bottom:0pt; font-family:Calibri Light; color:#2e74b5; font-size:large">
                                Example: Create a child domain under a parent domain
                            </h1>
                            <p>In this example, we create a domain, and then create a child domain on another node.</p>
                            <p>&nbsp;</p>
                            <div class="scriptcode">
                                <div class="pluginEditHolder" plugincommand="mceScriptCode">
                                    <div class="title"><span>PowerShell</span></div>
                                    <div class="pluginLinkHolder"><span class="pluginEditHolderLink">Edit</span>|<span class="pluginRemoveHolderLink">Remove</span></div>
                                    <span class="hidden">powershell</span>
                                    <div class="preview">
<pre class="powershell"><span class="powerShell__com">#&nbsp;Configuration&nbsp;to&nbsp;Setup&nbsp;Parent&nbsp;Child&nbsp;Domains&nbsp;</span>&nbsp;
&nbsp;
configuration&nbsp;AssertParentChildDomains&nbsp;
{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;<span class="powerShell__keyword">param</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$safemodeAdministratorCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$domainCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$DNSDelegationCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$NewADUserCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Import<span class="powerShell__operator">-</span>DscResource&nbsp;<span class="powerShell__operator">-</span>ModuleName&nbsp;xActiveDirectory&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Node&nbsp;<span class="powerShell__variable">$AllNodes</span>.Where{<span class="powerShell__variable">$_</span>.Role&nbsp;<span class="powerShell__operator">-</span>eq&nbsp;<span class="powerShell__string">&quot;Parent&nbsp;DC&quot;</span>}.Nodename&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WindowsFeature&nbsp;ADDSInstall&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;=&nbsp;<span class="powerShell__string">&quot;AD-Domain-Services&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADDomain&nbsp;FirstDS&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SafemodeAdministratorPassword&nbsp;=&nbsp;<span class="powerShell__variable">$safemodeAdministratorCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DnsDelegationCredential&nbsp;=&nbsp;<span class="powerShell__variable">$DNSDelegationCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[WindowsFeature]ADDSInstall&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xWaitForADDomain&nbsp;DscForestWait&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainUserCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryCount&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryIntervalSec&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xADDomain]FirstDS&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADUser&nbsp;FirstUser&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domaincred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UserName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dummy&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Password&nbsp;=&nbsp;<span class="powerShell__variable">$NewADUserCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xWaitForADDomain]DscForestWait&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Node&nbsp;<span class="powerShell__variable">$AllNodes</span>.Where{<span class="powerShell__variable">$_</span>.Role&nbsp;<span class="powerShell__operator">-</span>eq&nbsp;<span class="powerShell__string">&quot;Child&nbsp;DC&quot;</span>}.Nodename&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WindowsFeature&nbsp;ADDSInstall&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;=&nbsp;<span class="powerShell__string">&quot;AD-Domain-Services&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xWaitForADDomain&nbsp;DscForestWait&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.ParentDomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainUserCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryCount&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryIntervalSec&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[WindowsFeature]ADDSInstall&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADDomain&nbsp;ChildDS&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ParentDomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.ParentDomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SafemodeAdministratorPassword&nbsp;=&nbsp;<span class="powerShell__variable">$safemodeAdministratorCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xWaitForADDomain]DscForestWait&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
}&nbsp;
&nbsp;
<span class="powerShell__variable">$ConfigData</span>&nbsp;=&nbsp;@{&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;AllNodes&nbsp;=&nbsp;@(&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nodename&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-testNode1&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Role&nbsp;=&nbsp;<span class="powerShell__string">&quot;Parent&nbsp;DC&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-test.contoso.com&quot;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CertificateFile&nbsp;=&nbsp;<span class="powerShell__string">&quot;C:\publicKeys\targetNode.cer&quot;</span>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thumbprint&nbsp;=&nbsp;<span class="powerShell__string">&quot;AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8&quot;</span>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;50&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;30&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nodename&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-testNode2&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Role&nbsp;=&nbsp;<span class="powerShell__string">&quot;Child&nbsp;DC&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-child&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ParentDomainName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-test.contoso.com&quot;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CertificateFile&nbsp;=&nbsp;<span class="powerShell__string">&quot;C:\publicKeys\targetNode.cer&quot;</span>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thumbprint&nbsp;=&nbsp;<span class="powerShell__string">&quot;AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8&quot;</span>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;50&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;
}&nbsp;
&nbsp;
AssertParentChildDomains&nbsp;<span class="powerShell__operator">-</span>configurationData&nbsp;<span class="powerShell__variable">$ConfigData</span>&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>safemodeAdministratorCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;Domain&nbsp;Safe&nbsp;Mode&nbsp;Admin&nbsp;Credentials&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>domainCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;Domain&nbsp;Admin&nbsp;Credentials&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>DNSDelegationCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Credentials&nbsp;to&nbsp;Setup&nbsp;DNS&nbsp;Delegation&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>NewADUserCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;AD&nbsp;User&nbsp;Credentials&quot;</span>)&nbsp;
&nbsp;
&nbsp;
Start<span class="powerShell__operator">-</span>DscConfiguration&nbsp;<span class="powerShell__operator">-</span>Wait&nbsp;<span class="powerShell__operator">-</span>Force&nbsp;<span class="powerShell__operator">-</span>Verbose&nbsp;<span class="powerShell__operator">-</span>ComputerName&nbsp;<span class="powerShell__string">&quot;dsc-testNode1&quot;</span>&nbsp;<span class="powerShell__operator">-</span>Path&nbsp;<span class="powerShell__variable">$PSScriptRoot</span>\AssertParentChildDomains&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>Credential&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Local&nbsp;Admin&nbsp;Credentials&nbsp;on&nbsp;Remote&nbsp;Machine&quot;</span>)&nbsp;
Start<span class="powerShell__operator">-</span>DscConfiguration&nbsp;<span class="powerShell__operator">-</span>Wait&nbsp;<span class="powerShell__operator">-</span>Force&nbsp;<span class="powerShell__operator">-</span>Verbose&nbsp;<span class="powerShell__operator">-</span>ComputerName&nbsp;<span class="powerShell__string">&quot;dsc-testNode2&quot;</span>&nbsp;<span class="powerShell__operator">-</span>Path&nbsp;<span class="powerShell__variable">$PSScriptRoot</span>\AssertParentChildDomains&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>Credential&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Local&nbsp;Admin&nbsp;Credentials&nbsp;on&nbsp;Remote&nbsp;Machine&quot;</span>)&nbsp;
&nbsp;
</pre>
                                    </div>
                                </div>
                            </div>
                        </span>
                    </div>
                    <div class="endscriptcode">
                        &nbsp;<span style="font-family:Calibri; font-size:medium">
                            <h1 style="margin-bottom:0pt; font-family:Calibri Light; color:#2e74b5; font-size:large">
                                Example: Create a cross-domain trust
                            </h1>
                            <p>In this example, we setup one-way trust between two domains</p>
                            <p>&nbsp;</p>
                            <div class="scriptcode">
                                <div class="pluginEditHolder" plugincommand="mceScriptCode">
                                    <div class="title"><span>PowerShell</span></div>
                                    <div class="pluginLinkHolder"><span class="pluginEditHolderLink">Edit</span>|<span class="pluginRemoveHolderLink">Remove</span></div>
                                    <span class="hidden">powershell</span>
<pre class="hidden"> 
configuration Sample_xADDomainTrust_OneWayTrust
{
    param
    (
        [Parameter(Mandatory)]
        [String]$SourceDomain,
        [Parameter(Mandatory)]
        [String]$TargetDomain,
        
        [Parameter(Mandatory)]
        [PSCredential]$TargetDomainAdminCred,
        [Parameter(Mandatory)]
        [String]$TrustDirection
    )
    Import-DscResource -module xActiveDirectory
    Node $AllNodes.Where{$_.Role -eq 'DomainController'}.NodeName
    {
        xADDomainTrust trust
        {
            Ensure                              = 'Present'
            SourceDomainName                    = $SourceDomain
            TargetDomainName                    = $TargetDomain
            TargetDomainAdministratorCredential = $TargetDomainAdminCred
            TrustDirection                      = $TrustDirection
            TrustType                           = 'External'
        }
    }
}
$config = @{
    AllNodes = @(
        @{
            NodeName      = 'localhost'
            Role          = 'DomainController'
            # Certificate Thumbprint that is used to encrypt/decrypt the credential
            CertificateID = 'B9192121495A307A492A19F6344E8752B51AC4A6'
        }
    )
}
Sample_xADDomainTrust_OneWayTrust -configurationdata $config `
                                  -SourceDomain safeharbor.contoso.com `
                                  -TargetDomain corporate.contoso.com `
                                  -TargetDomainAdminCred (get-credential) `
                                  -TrustDirection 'Inbound'
</pre>
                                    <div class="preview">
<pre class="powershell"><span class="powerShell__com">#&nbsp;Configuration&nbsp;to&nbsp;Setup&nbsp;Parent&nbsp;Child&nbsp;Domains&nbsp;</span>&nbsp;
&nbsp;
configuration&nbsp;AssertParentChildDomains&nbsp;
{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;<span class="powerShell__keyword">param</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$safemodeAdministratorCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$domainCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$DNSDelegationCred</span>,&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Parameter(Mandatory)]&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pscredential]<span class="powerShell__variable">$NewADUserCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Import<span class="powerShell__operator">-</span>DscResource&nbsp;<span class="powerShell__operator">-</span>ModuleName&nbsp;xActiveDirectory&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Node&nbsp;<span class="powerShell__variable">$AllNodes</span>.Where{<span class="powerShell__variable">$_</span>.Role&nbsp;<span class="powerShell__operator">-</span>eq&nbsp;<span class="powerShell__string">&quot;Parent&nbsp;DC&quot;</span>}.Nodename&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WindowsFeature&nbsp;ADDSInstall&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;=&nbsp;<span class="powerShell__string">&quot;AD-Domain-Services&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADDomain&nbsp;FirstDS&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SafemodeAdministratorPassword&nbsp;=&nbsp;<span class="powerShell__variable">$safemodeAdministratorCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DnsDelegationCredential&nbsp;=&nbsp;<span class="powerShell__variable">$DNSDelegationCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[WindowsFeature]ADDSInstall&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xWaitForADDomain&nbsp;DscForestWait&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainUserCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryCount&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryIntervalSec&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xADDomain]FirstDS&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADUser&nbsp;FirstUser&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domaincred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UserName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dummy&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Password&nbsp;=&nbsp;<span class="powerShell__variable">$NewADUserCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xWaitForADDomain]DscForestWait&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Node&nbsp;<span class="powerShell__variable">$AllNodes</span>.Where{<span class="powerShell__variable">$_</span>.Role&nbsp;<span class="powerShell__operator">-</span>eq&nbsp;<span class="powerShell__string">&quot;Child&nbsp;DC&quot;</span>}.Nodename&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WindowsFeature&nbsp;ADDSInstall&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ensure&nbsp;=&nbsp;<span class="powerShell__string">&quot;Present&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;=&nbsp;<span class="powerShell__string">&quot;AD-Domain-Services&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xWaitForADDomain&nbsp;DscForestWait&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.ParentDomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainUserCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryCount&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.RetryIntervalSec&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[WindowsFeature]ADDSInstall&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xADDomain&nbsp;ChildDS&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.DomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ParentDomainName&nbsp;=&nbsp;<span class="powerShell__variable">$Node</span>.ParentDomainName&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainAdministratorCredential&nbsp;=&nbsp;<span class="powerShell__variable">$domainCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SafemodeAdministratorPassword&nbsp;=&nbsp;<span class="powerShell__variable">$safemodeAdministratorCred</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DependsOn&nbsp;=&nbsp;<span class="powerShell__string">&quot;[xWaitForADDomain]DscForestWait&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
}&nbsp;
&nbsp;
<span class="powerShell__variable">$ConfigData</span>&nbsp;=&nbsp;@{&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;AllNodes&nbsp;=&nbsp;@(&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nodename&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-testNode1&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Role&nbsp;=&nbsp;<span class="powerShell__string">&quot;Parent&nbsp;DC&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-test.contoso.com&quot;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CertificateFile&nbsp;=&nbsp;<span class="powerShell__string">&quot;C:\publicKeys\targetNode.cer&quot;</span>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thumbprint&nbsp;=&nbsp;<span class="powerShell__string">&quot;AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8&quot;</span>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;50&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;30&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@{&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nodename&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-testNode2&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Role&nbsp;=&nbsp;<span class="powerShell__string">&quot;Child&nbsp;DC&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DomainName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-child&quot;</span>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ParentDomainName&nbsp;=&nbsp;<span class="powerShell__string">&quot;dsc-test.contoso.com&quot;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CertificateFile&nbsp;=&nbsp;<span class="powerShell__string">&quot;C:\publicKeys\targetNode.cer&quot;</span>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thumbprint&nbsp;=&nbsp;<span class="powerShell__string">&quot;AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8&quot;</span>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryCount&nbsp;=&nbsp;50&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetryIntervalSec&nbsp;=&nbsp;30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;
}&nbsp;
&nbsp;
AssertParentChildDomains&nbsp;<span class="powerShell__operator">-</span>configurationData&nbsp;<span class="powerShell__variable">$ConfigData</span>&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>safemodeAdministratorCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;Domain&nbsp;Safe&nbsp;Mode&nbsp;Admin&nbsp;Credentials&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>domainCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;Domain&nbsp;Admin&nbsp;Credentials&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>DNSDelegationCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Credentials&nbsp;to&nbsp;Setup&nbsp;DNS&nbsp;Delegation&quot;</span>)&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>NewADUserCred&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;New&nbsp;AD&nbsp;User&nbsp;Credentials&quot;</span>)&nbsp;
&nbsp;
&nbsp;
Start<span class="powerShell__operator">-</span>DscConfiguration&nbsp;<span class="powerShell__operator">-</span>Wait&nbsp;<span class="powerShell__operator">-</span>Force&nbsp;<span class="powerShell__operator">-</span>Verbose&nbsp;<span class="powerShell__operator">-</span>ComputerName&nbsp;<span class="powerShell__string">&quot;dsc-testNode1&quot;</span>&nbsp;<span class="powerShell__operator">-</span>Path&nbsp;<span class="powerShell__variable">$PSScriptRoot</span>\AssertParentChildDomains&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>Credential&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Local&nbsp;Admin&nbsp;Credentials&nbsp;on&nbsp;Remote&nbsp;Machine&quot;</span>)&nbsp;
Start<span class="powerShell__operator">-</span>DscConfiguration&nbsp;<span class="powerShell__operator">-</span>Wait&nbsp;<span class="powerShell__operator">-</span>Force&nbsp;<span class="powerShell__operator">-</span>Verbose&nbsp;<span class="powerShell__operator">-</span>ComputerName&nbsp;<span class="powerShell__string">&quot;dsc-testNode2&quot;</span>&nbsp;<span class="powerShell__operator">-</span>Path&nbsp;<span class="powerShell__variable">$PSScriptRoot</span>\AssertParentChildDomains&nbsp;`&nbsp;
<span class="powerShell__operator">-</span>Credential&nbsp;(<span class="powerShell__cmdlets">Get-Credential</span>&nbsp;<span class="powerShell__operator">-</span>Message&nbsp;<span class="powerShell__string">&quot;Local&nbsp;Admin&nbsp;Credentials&nbsp;on&nbsp;Remote&nbsp;Machine&quot;</span>)&nbsp;
&nbsp;
</pre>
                                    </div>
                                </div>
                            </div>
                        </span>
                    </div>
                </span>
            </div>
        </div>

</body>
</html>